<?php // var_dump(checklogin()); ?>
<!DOCTYPE html>
<html lang="zh-CN" style="background-color: #F40941">
  <head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>开心转盘</title>
    <link rel="stylesheet" href="{RES}/css/typo.css">
    <link rel="stylesheet" href="{RES}/css/GB-canvas-turntable.css">
    <link rel="stylesheet" href="{RES}/css/style.css">
      <style>
          .wrapper{
              /*padding:20px 40px;*/
              padding-top: 20px;
          }
          .fork-github{
              position: fixed;
              right: -100px;
              top: 45px;
              z-index: 9999;
              padding: 2px 100px;
              font-size: 12px;
              background-color: #444;
              border: 1px solid #000;
              -webkit-transform: rotate(45deg);
              -ms-transform: rotate(45deg);
              transform: rotate(45deg);
              text-align: center;
          }
          .fork-github a{
              color: #fff;
          }

          .gb-turntable a.gb-turntable-btn{
              border: none;
          }

      </style>
  </head>
  <body ontouchstart style="overflow-x: hidden;background:url('{RES}/img/zpbac.jpg');" >


  <div class="wrapper typo" id="wrapper">


      <section id="turntable" class="gb-turntable">

          <div class="gb-turntable-container">
              <canvas class="gb-turntable-canvas" width="300" height="300px">抱歉！浏览器不支持。</canvas>
          </div>

          <a class="gb-turntable-btn" href="javascript:;">抽奖<i class="gb-turntable-btn2"></i></a>
      </section>

  </div>
	
    <div class="act-info">
          <div class="act-info2">
            <p class="act-info1">活动说明</p>
            <div>{$system['act_info']}</div>
          </div>

    </div>
    <div class="act-log">
        <a href="{php echo $this->createMobileUrl('log')}"><div>我的抽奖机记录</div></a>
    </div>
	
    <script src="{RES}/js/GB-canvas-turntable.min.js"></script>
    <script src="{RES}/js/jquery2.2.3.min.js"></script>
    <script type="text/javascript">




        // 背景色
        var color = {$colors};
        // ico
        var background = {$pics};

        var names = {$names};

        var blank;



        document.addEventListener('DOMContentLoaded', function() {
            gbTurntable.init({
                id: 'turntable',
                config: function(callback){
                    // 获取奖品信息
                    callback && callback(names);
                },
                getPrize: function(callback) {

                    // 获取中奖信息
                   var num;
                   var chances;

                    $.ajax({
                        url:"{php echo $this->createMobileUrl('Draw')}",
                        type:"post",
                        data:{},
                        async: false,
                        success:function (res) {

                            res = $.parseJSON(res);

                            if (res.state == 'success')
                            {
                                 num = res.keyid;   //奖品ID
                                 chances = 1;  // 可抽奖次数
                                 blank = res.blank;

                            } else
                            {
                                alert(res.msg);

                            }

                        }

                    })

                        callback && callback([num, chances]);   
                },
                gotBack: function(data) {

                    if (blank == 2)
                    {
                        alert(data);

                    } else
                    {
                        alert('恭喜抽中' + data);
                    }

                }
            }); 
        }, false);
        $(".gb-turntable-btn").css("background-color","{$color1}");
        $(".gb-turntable-btn2").css("border-bottom-color","{$color1}");
        $("#turntable").css("border-color","{$color2}");

    </script>
  </body>
</html>
